package logic

import (
	"activity_srv/activity"
	"activity_srv/internal/dao"
	"activity_srv/internal/svc"
	"context"
	"github.com/zeromicro/go-zero/core/logx"
	"go.uber.org/zap"
	"smart-health-platforms/pkg"
)

type UpdateSeckillOrderStatusLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewUpdateSeckillOrderStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateSeckillOrderStatusLogic {
	return &UpdateSeckillOrderStatusLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *UpdateSeckillOrderStatusLogic) UpdateSeckillOrderStatus(in *activity.UpdateSeckillOrderStatusRequest) (*activity.UpdateSeckillOrderStatusResponse, error) {
	_, err := dao.UpdateSeckillOrderStatus(in)
	if err != nil {
		pkg.Error("更新秒杀订单状态失败", zap.Error(err))
		return nil, err
	}

	return &activity.UpdateSeckillOrderStatusResponse{}, nil
}
